home *** CD-ROM | disk | FTP | other *** search
- /* mousefnc.c */
-
- /* mouse functions */
-
- /* by James B. Burks (1988) */
-
- /* released into the public domain by the author */
-
- #include <stdio.h>
- #include <bios.h>
- #include <dos.h>
-
- #include "mousedef.h"
-
- void cmouses(int *m1, int *m2, int *m3, int *m4)
-
- { /* begin cmouses */
- /* lowest-level routine. Calls the Microsoft-compatible mouse driver
- directly using the Turbo-C Int86 routine to call INT 33.
- */
-
- union REGS regs;
-
- regs.x.ax = *m1;
- regs.x.bx = *m2;
- regs.x.cx = *m3;
- regs.x.dx = *m4;
-
- int86(0x33, ®s, ®s);
-
- *m1 = regs.x.ax;
- *m2 = regs.x.bx;
- *m3 = regs.x.cx;
- *m4 = regs.x.dx;
-
- } /* end cmouses */
-
-
- int m_reset(void)
-
- { /* begin m_reset*/
-
- /* this routine initializes the mouse driver (if present)
- and returns the number of buttons (0 if no mouse driver).
- It should be called after any change of video mode number.
- */
-
- int m1 = 0 , m2, m3, m4;
-
- cmouses(&m1, &m2, &m3, &m4);
-
- if (m1 == -1)
- return(m2);
- else
- return(0);
-
- } /* end m_reset */
-
-
- void m_show_cursor(void)
-
- { /* begin m_show_cursor */
-
- /* function which instructs the mouse driver to show the mouse cursor
- and track the mouse motion. If multiple calls to m_hide_cursor
- are done, you must make multiple calls to m_show_cursor.
- */
-
- int m1 = 1, m2, m3, m4;
-
- cmouses(&m1, &m2, &m3, &m4);
-
- } /* end m_show_cursor */
-
-
- void m_hide_cursor(void)
-
- { /* begin m_hide_cursor */
-
- /* removes the mouse cursor from the screen. */
-
- int m1 = 2, m2, m3, m4;
-
- cmouses(&m1, &m2, &m3, &m4);
-
- } /* end m_hide_cursor */
-
-
- int m_status(int *ix, int *iy)
-
- { /* begin m_status */
-
- /* function which returns the button status as value, and the current
- x/y position as arguments.
- */
-
- int m1 = 3, m2;
-
- cmouses(&m1, &m2, ix, iy );
-
- return(m2);
-
- } /* end m_status */
-
-
- int m_release(int bs, int *ix, int *iy)
-
- { /* begin m_release */
-
- /* function which returns the number of button releases since the
- last call to m_release. The x/y position of the last button
- press are also returned.
- */
-
- int m1 = 6, m2 = bs;
-
- cmouses(&m1,&m2, ix, iy);
-
- return(m2);
-
- } /* end m_release */
-
- void m_graphics_cursor( int *graph_ptr)
-
- { /* begin m_grahpics_cursor */
-
- /* This function allows you to change the shape of the mouse cursor
- in graphics mode. You cannot change the text mode cursor.
- */
-
- int m1 = 9, m2 = -1, m3 = -1;
-
- cmouses(&m1, &m2, &m3, graph_ptr);
-
- } /* end m_grahpics_cursor */
-
-
- void m_cursor_set(int *ix, int *iy)
-
- { /* begin m_cursor_set */
-
- /* allows the program to reset the current cursor position both on the
- screen and in the mouse driver. Note: It does not physically
- move the mouse.
- */
-
- int m1 = 4, m2;
-
- cmouses(&m1, &m2, ix, iy );
-
- } /* end m_cursor_set */
-
- void m_region(int hmin, int hmax, int vmin, int vmax)
-
- { /* begin m_region */
-
- /* allows you to restrict the mouse motion to a given rectangular region
- on the screen.
- */
-
- int m1 =7, m2;
-
- cmouses(&m1,&m2, &hmin, &hmax); /* sets min/max horizontal mouse position */
-
- m1 = 8;
-
- cmouses(&m1, &m2, &vmin, &vmax); /* sets min/max vertical mouse position */
-
- } /* end m_region */
-
- /* eof mousefnc.c */